home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / ab20 / ab20_archive / text / cmanual.lzh / ACM3.lzh / AmigaDOS / Example2.c < prev    next >
C/C++ Source or Header  |  1991-01-12  |  856b  |  32 lines

  1. /* Example 2                                                  */
  2. /* This example demonstrates how to create a directory called */
  3. /* "MyDirectory" on the RAM disk.                             */
  4.  
  5.  
  6. #include <libraries/dos.h>
  7.  
  8.  
  9. void main();
  10.  
  11. void main()
  12. {
  13.   /* Declare a FileLock structure: */
  14.   struct FileLock *lock;
  15.  
  16.   /* Create a directory on the RAM disk: (The directory will */
  17.   /* be locked with an exclusive lock, and must therefore be */
  18.   /* unlocked before the program terminates.)                */
  19.   lock = (struct FileLock *) CreateDir( "RAM:MyDirectory" );
  20.  
  21.   /* If there is no lock, no directory has been created. In  */
  22.   /* that case, inform the user about the problem and leave: */
  23.   if( lock == NULL )
  24.   {
  25.     printf( "ERROR Could NOT create the new directory!\n" );
  26.     exit( 0 );
  27.   }
  28.  
  29.   /* Unlock the directory: */
  30.   UnLock( lock );
  31. }
  32.